<template>
  <!--模板-->
  {{ model }}<br>
  <el-button type="" @click="change1">修改</el-button><br> 
  <el-input v-model="myName" placeholder=""></el-input>
  <input v-model="myName" placeholder=""/>

</template>
  
   
  
<script setup lang="ts">
  import { computed } from 'vue'
  import { getPerson, getPerson2 } from './50-config'
  import type { IPerson } from './50-config'

  const props = defineProps<{
    modelValue: string
  }>()
  const emit = defineEmits(['update:modelValue'])

  const myName = computed({
    get() {
      return props.modelValue
    },
    set(value) {
      emit('update:modelValue', value)
    }
  })
  
  const model = getPerson2<IPerson>()

  model.$state = {
    name: 'ok',
    age:2
  }
  model.name = '子组件获取后，也可以带上类型'

  let i = 1
  const change1 = () => {
    model.$state = {
      name: '子组件里面修改' + i++,
      age:  i++
    }
  }
</script>